Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#11): include input checkbox for task lists #12

Merged
merged 20 commits into from
Jan 11, 2025

Conversation

KyleKing
Copy link
Contributor

@KyleKing KyleKing commented Dec 21, 2024

This is the first go project I've actually worked on, so any guidance would be appreciated! I've been running make test lint locally, but the Emoji test (35) fails and I think my changes are generally the right direction, but I'm not sure what to do to finish the change

Fixes #11

@sivukhin
Copy link
Owner

sivukhin commented Dec 21, 2024

Hi @KyleKing!

Yes, emoji test were broken in the master as tests download fresh HTML from djot syntax spec page (https://htmlpreview.github.io/?https://github.com/jgm/djot/blob/master/doc/syntax.html) which recently changed symbols example. I fixed them - so if you will update your fork - this test must be good for now.

Regarding the approach - what do you think if input checkbox will be supported only in the rendering layer? I see drawback in the current approach as new AST for checkboxed-list can make maintenance harder because on one hand - this is new AST node but on the other hand - it must behave just as regular list and the only difference is in the presentation layer.

I would suggest to add this feature only in the rendering layer by extending logic of DefaultConversionRegistry for ListItemNode. But internally all lists will be presented as ListItemNode.

The development flow is simple and you did everything right: make lint test is enough and I didn't setup any more automatic checks. One useful thing can be to run FuzzDjotE2E / FuzzDjotTokenizer tests in fuzzing mode (pass -fuzz argument to the go test command) if you touch parser internals - because its proven (by myself) that mistakes are easy to made in this code :) But for "front-end" rendering part it's not that useful as conversions in this part of the code is pretty straightforward.

@KyleKing KyleKing marked this pull request as ready for review January 2, 2025 20:56
Copy link
Contributor Author

@KyleKing KyleKing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for review again! Feel free to make changes directly if easier than providing feedback

I also ran fuzz testing locally (go test -fuzz FuzzDjotTokenizer -fuzz FuzzDjotE2E github.com/sivukhin/godjot/djot_parser). I'm not sure how long to let it run, but it ran for two minutes after this fix without finding any new issues.

fuzz: elapsed: 0s, gathering baseline coverage: 0/699 completed
fuzz: elapsed: 0s, gathering baseline coverage: 699/699 completed, now fuzzing with 10 workers
fuzz: elapsed: 3s, execs: 165661 (55208/sec), new interesting: 13 (total: 712)
fuzz: elapsed: 6s, execs: 338017 (57444/sec), new interesting: 26 (total: 725)
...
fuzz: elapsed: 2m6s, execs: 5540830 (33608/sec), new interesting: 191 (total: 890)
^Cfuzz: elapsed: 2m7s, execs: 5553930 (23612/sec), new interesting: 191 (total: 890)
PASS
ok      github.com/sivukhin/godjot/djot_parser  127.064s

djot_parser/djot_html.go Outdated Show resolved Hide resolved
`go test -run=FuzzDjotE2E/326270ac6d2da709
github.com/sivukhin/godjot/djot_parser`
Copy link
Owner

@sivukhin sivukhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like current approach but seems like current code has a bug if item list has some non-trivial internal content

djot_parser/djot_html.go Outdated Show resolved Hide resolved
djot_parser/examples/todo-list.html Show resolved Hide resolved
@KyleKing KyleKing marked this pull request as draft January 6, 2025 00:56
Copy link
Contributor Author

@KyleKing KyleKing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! I can finish resolving the extra newline in the test tomorrow or it could probably be merged as-is (I run the generated HTML through a minifier anyway)

djot_parser/examples/todo-list.html Outdated Show resolved Hide resolved
djot_parser/examples/todo-list.html Show resolved Hide resolved
@KyleKing KyleKing marked this pull request as ready for review January 8, 2025 01:23
@KyleKing KyleKing requested a review from sivukhin January 8, 2025 01:34
- there is a tricky code which handle EOF - so let's add newline in the
  djot markup to mitigate any nuances related to that
Copy link
Owner

@sivukhin sivukhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked djot markup in todo-list test a bit because there are nuances related to the EOF handling in godjot

I will merge this branch. @KyleKing - thanks one more time for contribution! Sorry that it took longer than it actually needed to be!

@sivukhin sivukhin merged commit 4f96121 into sivukhin:master Jan 11, 2025
2 checks passed
@KyleKing KyleKing deleted the fix-11 branch January 11, 2025 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output HTML Checkbox
2 participants